package com.fsc.util.socket;

import com.corundumstudio.socketio.SocketIOServer;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class SocketStart {
    @Autowired
    private SocketIOServer socketIOServer;
    @PostConstruct
    public void start(){
        socketIOServer.start();
        log.info("socket.io启动成功");
    }
    @PreDestroy
    public void stop(){
        socketIOServer.stop();
        log.info("socket.io停止成功");
    }
}
